CSharpTest.Net
Clone Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.BPlusTree Assembly > CSharpTest.Net.Collections Namespace > BPlusTree.Options<TKey,TValue> Class : Clone Method

Glossary Item Box

Creates a shallow clone of the configuration options.

Syntax

Visual Basic (Declaration) 
Public Shadows Function Clone() As BPlusTree(Of TKey,TValue)
C# 
public new BPlusTree<TKey,TValue> Clone()

Example

BPlusTree/BPlusTree.Test/TestBPlusTreeOptions.cs

C#Copy Code
var options = new BPlusTree<int, int>.Options(PrimitiveSerializer.Int32, PrimitiveSerializer.Int32)
{
    CreateFile = CreatePolicy.IfNeeded,
    BTreeOrder = 4
};
var copy = options.Clone();

Assert.IsFalse(Object.ReferenceEquals(options, copy));
Assert.IsTrue(Object.ReferenceEquals(options.CallLevelLock, copy.CallLevelLock));

//If we get/set the lock prior to clone we will have the same lock instance.
options.CallLevelLock = new SimpleReadWriteLocking();
copy = options.Clone();

Assert.IsFalse(Object.ReferenceEquals(options, copy));
Assert.IsTrue(Object.ReferenceEquals(options.CallLevelLock, copy.CallLevelLock));
VB.NETCopy Code
Dim options As var = New BPlusTree(Of Integer, Integer).Options(PrimitiveSerializer.Int32, PrimitiveSerializer.Int32) With { _
    Key .CreateFile = CreatePolicy.IfNeeded, _
    Key .BTreeOrder = 4 _
}
Dim copy As var = options.Clone()

Assert.IsFalse([Object].ReferenceEquals(options, copy))
Assert.IsTrue([Object].ReferenceEquals(options.CallLevelLock, copy.CallLevelLock))

'If we get/set the lock prior to clone we will have the same lock instance.
options.CallLevelLock = New SimpleReadWriteLocking()
copy = options.Clone()

Assert.IsFalse([Object].ReferenceEquals(options, copy))
Assert.IsTrue([Object].ReferenceEquals(options.CallLevelLock, copy.CallLevelLock))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys